{extend name="./app" /}

{block name="title"}首页{/block}

{block name="body"}
<div class="container">
    <div class="row">
        <div class="col-sm-9">
            <div class="row">
                {volist name="sentences" id="sentence"}
                <div class="col-sm-12 sentence-item">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <p>
                                <a href="{:url1('index/sentence/show', ['id' => $sentence->id])}">{$sentence->sentence}</a>
                            </p>
                            <p>
                                {if condition="$sentence->tags"}
                                {volist name="$sentence->tags" id="tag"}
                                <span class="label label-default">{$tag->name}</span>
                                {/volist}
                                {/if}
                            </p>
                        </div>
                        {if condition="$sentence->user"}
                        <div class="panel-footer">
                            <p class="text-right">——&nbsp;<b>{$sentence->user->username}</b></p>
                        </div>
                        {/if}
                    </div>
                </div>
                {/volist}
                <div class="col-sm-12 text-right">
                    {:htmlspecialchars_decode($sentences->render())}
                </div>
            </div>
        </div>

        <div class="col-sm-3">
            <div class="row">
                <div class="col-sm-12">
                    {if condition="$user"}
                    <p><a href="{:url1('index/sentence/create')}" class="btn btn-primary btn-block">我要说</a></p>
                    {else}
                    <p><a href="{:url1('index/login/index')}" class="btn btn-primary btn-block">登陆</a></p>
                    <p class="text-center color-gray"><a href="{:url1('index/register/index')}">注册</a></p>
                    {/if}
                </div>
            </div>
        </div>
    </div>
</div>
{/block}